<?php



namespace App\Http\Requests\Company;

use App\Services\Base\Interfaces\ConfigServiceInterface;
use App\Services\Base\Services\ConfigService;
use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;

class DeviceRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [

            'serial_number' => 'required',

        ];
    }

    public function messages()
    {
        return [
            'serial_number.required' => __('请输入序列号'),
            'validate_code.required' => __('请输入验证码'),

        ];
    }

    public function filldata()
    {

        /**
         * @var $configService ConfigService
         */
        $configService = app()->make(ConfigServiceInterface::class);
        $user = Auth::user();
        return [
            'user_id'=>$user['id'],
            'company_id'=>$user['login_company_id'],
            'area'=>$this->input('area'),
            'serial_number'=>$this->input('serial_number'),
            'validate_code'=>$this->input('validate_code'),
            'name'=>$this->input('name'),
            'channel'=>$this->input('channel'),
            'model'=>$this->input('model'),
        ];
    }
}
